import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import UnoCSS from 'unocss/vite'
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'

// https://vite.dev/config/
export default defineConfig({
  plugins: [
    vue(), 
    UnoCSS(),
    // Vue 自动导入
    AutoImport({
      imports: [
        'vue',
        'vue-router',
        '@vueuse/core'
      ],
      dts: './types/auto-imports.d.ts',
      eslintrc: {
        enabled: true,
        filepath: './.eslintrc-auto-import.json',
        globalsPropValue: true,
      },
    }),
    // Element Plus 自动导入
    Components({
      resolvers: [
        ElementPlusResolver({
          importStyle: 'css', // 使用 css 样式
        }),
      ],
      dts: './types/components.d.ts',
    }),
  ],
  server: {
    port: 80,
    host: '0.0.0.0',
    open: true,
  }
})
